<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>animation</title>
    <style type="text/css">

        /* 定义动画 */
        @keyframes moving {
            from {
                width: 100px;
            }
            to {
                width: 500px;
            }
        }

        .box {
            width: 100px;
            height: 100px;
            background-color: #6DDCBD;
            margin: 50px;
            animation-name: moving; /* 动画名称 */
            animation-duration: 1s; /* 动画时间 */
            animation-timing-function: ease; /* 运动方式 ease 缓冲*/
            animation-delay: 0ms; /* 延时 */
            animation-iteration-count: infinite; /*播放次数 无穷*/
            animation-direction: alternate; /* 让动画效果原路返回*/
            animation-play-state: running; /* 控制动画静还是动 */
            animation-fill-mode: backwards; /* 定义动画前后状态 */
        }

        .box:hover{
            animation-play-state:paused;
        }

        @keyframes rotate {
            from {
                transform: perspective(400px) rotateZ(0deg) ;
            }
            to {
                transform: perspective(400px) rotateZ(360deg) ;
            }
        }
        .con{
        width: 600px;
        height: 600px;
        border: 1px solid #000;
        margin: 50px auto;
        transform-style: preserve-3d;
        }
        .con img {
            position: absolute;
            left: 100px;
            top: 100px;
            transform: perspective(400px) rotateY(0deg) ;
            transition: all 500ms ease;
            backface-visibility: visible; /* 设置图片背面是否可见 */

            animation-name: rotate; /* 动画名称 */
            animation-duration: 2s; /* 动画时间 */
            animation-timing-function: linear; /* 运动方式 linear 匀速*/
            animation-delay: 0ms; /* 延时 */
            animation-iteration-count: infinite; /*播放次数 无穷*/
            animation-direction: unset;
            animation-play-state: running; /* 控制动画静还是动 */
            animation-fill-mode: backwards; /* 定义动画前后状态 */

        }
        .con:hover img{
            animation-play-state:paused;
        }
    </style>
</head>
<body>
    <div class="box">
    </div>
    <div class="box">
    </div>
    <div class="con">
        <img src="../images/cola.jpeg">
    </div>
</body>
</html>